<template>
  <div>
      <el-backtop target=".el-main" :bottom="100" :right="100" ref="backtop" />
    <el-config-provider :locale="locale">
      <div class="opps">
        <el-pagination
          v-model:currentPage="paging.page"  
          v-model:page-size="paging.limit"
          :page-sizes="[10, 20, 30, 40]"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"  
        />
      </div>
    </el-config-provider>
  </div>
</template>
<script>
import { ElConfigProvider } from "element-plus";
import zhCn from "element-plus/lib/locale/lang/zh-cn";
export default {
  components: {
    ElConfigProvider,
  },
  data() {
    return {
      locale: zhCn,
      targetAdminId: "",
      paging:{
        page:this.page,
        limit:this.limit
      }
    };
  },
  props:{
    page: Number, //默认第一页
    limit: Number,
    total:Number, //显示几页
  },
  methods: {
    handleSizeChange(val) {
      this.$emit("handleSizeChange", val);
    },
    handleCurrentChange(val) {
      this.$emit("handleCurrentChange",val);
            if (this.$refs.backtop.$el.data != "v-if") {
        this.$nextTick(() => {
          this.$refs.backtop.$el.click();
        });
      }
    },
  },
};
</script>
<style lang="less" scoped></style>
